// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import App from './App'
import router from './router'
import axios from 'axios'
import md5 from 'js-md5'
import { Loading, Message } from 'element-ui'

// 添加响应拦截器
axios.interceptors.response.use(function (response) {
  // 对响应数据做点什么
  if (response.data.data == 'AUTH-FAILED') {
    Message.error('阿萨德');
    $cookieStore.unsetAll('home_');
    location.hash='/index';
  }
  return response
}, function (error) {
  // 对响应错误做点什么
  return Promise.reject(error)
})

Vue.use(ElementUI)
Vue.prototype.$http = axios
Vue.prototype.$md5 = md5
Vue.config.productionTip = false

router.beforeResolve((to, from, next) => {
  // console.log(to)
  next();
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
